package com.biannuo.szk.shop.controller;

import com.biannuo.szk.common.base.BaseResponse;
import com.biannuo.szk.shop.feign.UserClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * 商店
 *
 * @author szk
 */
@RestController
public class ShopController extends BaseResponse {
    @Resource
    private UserClient userClient;
    /**
     * 模拟商品数据
     */
    private final Map<Integer, String> shopInfo = new HashMap<Integer, String>() {{
        put(1, "这是苹果");
        put(1024, "这是芒果");
    }};

    /**
     * 根据id查询商品信息的方法
     *
     * @param id
     * @return
     */
    @RequestMapping("/shop/findById")
    public String findById(@RequestParam("id") Integer id) {
        return shopInfo.getOrDefault(id, null);
    }

}